package com.javasm.mingming.adminuser.controller;



import com.javasm.mingming.adminuser.entity.AdminUser;
import com.javasm.mingming.adminuser.service.AdminSecurityService;
import com.javasm.mingming.adminuser.service.AdminUserService;
import com.javasm.mingming.common.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 后台用户(AdminUser)表控制层
 *
 * @author makejava
 * @since 2025-01-11 09:51:34
 */
@RestController
@RequestMapping("/adminUser")
public class AdminUserController {
    /**
     * 服务对象
     */
    @Resource
    private AdminUserService adminUserService;

    @Resource
    private AdminSecurityService adminSecurityService;
    @GetMapping("/list")
    public List<AdminUser> list(){
        List<AdminUser> list = adminUserService.list();
        return list;
    }

    @GetMapping("/list2")
    public List<AdminUser> list2(){
        return null;
    }

    //获取已经登录的用户信息
    @GetMapping("/query/myUser")
    public R queryLoginUser(){
        AdminUser adminUser = adminSecurityService.queryMyUser();
        return R.ok(adminUser);
    }

    @PutMapping("")
    public R update(@RequestBody AdminUser adminUser){
        adminSecurityService.updateAdminUser(adminUser);
        return R.ok();
    }

}

